<!--
 * @Description: 
 * @Date: 2024-05-15 15:16:04
 * @LastEditTime: 2024-06-14 10:16:32
-->
<route lang="json5">
{
  style: {
    navigationBarTitleText: '案件详情',
    navigationBarTextStyle: 'white', //标题栏字体颜色
    navigationBarBackgroundColor: '#0063AF', //标题栏背景色(纯色)
  },
}
</route>
<template>
  <view class="anJian w-screen h-screen bg-#F4F5F9">
    <view class="px-40rpx py30rpx bg-#fff">
      <wd-steps :active="active" align-center>
        <wd-step title="提交成功" />
        <wd-step title="审核中" />
        <wd-step title="审核结果" />
      </wd-steps>
    </view>
    <view class="p-20rpx box-border">
      <view class="mb-20rpx rounded-20rpx">
        <wd-cell>
          <template #title>
            <view>
              <view class="inline-block mr-10rpx">主体身份:</view>
              <view class="inline-block text-#5a5b5d">
                {{ getApplicantType(caseData.applicantType) }}
              </view>
            </view>
          </template>
        </wd-cell>
      </view>
      <view class="mb-20rpx rounded-20rpx">
        <wd-cell>
          <template #title>
            <view>
              <view class="inline-block mr-10rpx">被查询人姓名:</view>
              <view class="inline-block text-#5a5b5d">{{ caseData.partyName }}</view>
            </view>
          </template>
        </wd-cell>
        <wd-cell>
          <template #title>
            <view>
              <view class="inline-block mr-10rpx">被查询人身份证号:</view>
              <view class="inline-block text-#5a5b5d">{{ caseData.partyCard }}</view>
            </view>
          </template>
        </wd-cell>
      </view>
      <view class="mb-20rpx rounded-20rpx">
        <wd-cell>
          <template #title>
            <view>
              <view class="inline-block mr-10rpx">申请人:</view>
              <view class="inline-block text-#5a5b5d">{{ caseData.applicant }}</view>
            </view>
          </template>
        </wd-cell>
        <wd-cell>
          <template #title>
            <view>
              <view class="inline-block mr-10rpx">申请人手机号码:</view>
              <view class="inline-block text-#5a5b5d">{{ caseData.applicantPhone }}</view>
            </view>
          </template>
        </wd-cell>
      </view>
      <view class="mb-20rpx rounded-20rpx">
        <wd-cell>
          <template #title>
            <view>
              <view class="inline-block mr-10rpx">申请状态:</view>
              <view class="inline-block text-#5a5b5d">{{ getType(caseData.status) }}</view>
            </view>
          </template>
        </wd-cell>
        <wd-cell>
          <template #title>
            <view>
              <view class="inline-block mr-10rpx">审核说明:</view>
              <view class="text-#5a5b5d">
                {{ caseData.acceptContent }}
              </view>
            </view>
          </template>
        </wd-cell>
      </view>
    </view>
  </view>
</template>
<script setup lang="ts">
import { getCaseQueryAPI } from '@/service/index/foo'
import Base64 from 'base-64'
const active = ref<number>(0)
const promotionlist = ref<any[]>([
  {
    value: '1',
    label: '当事人',
  },
  {
    value: '2',
    label: '当事人法定代理人',
  },
  {
    value: '3',
    label: '当事人近亲属',
  },
  {
    value: '4',
    label: '辩护人',
  },
])
const typeList = [
  {
    value: 1,
    label: '审核中',
  },
  {
    value: 2,
    label: '审核通过',
  },
  {
    value: 3,
    label: '审核驳回',
  },
]
const caseData = ref({
  applicantType: undefined,
  applicantPhone: undefined,
  applicant: undefined,
  partyName: undefined,
  partyCard: undefined,
  status: undefined,
  acceptContent: undefined,
})
const getType = computed(() => {
  return function (index) {
    if (index != undefined) {
      return typeList.filter((item) => {
        return item.value == index
      })[0].label
    }
  }
})

const getApplicantType = computed(() => {
  return function (index) {
    if (index) {
      return promotionlist.value.filter((item) => {
        return item.value == index
      })[0].label
    }
  }
})

onLoad((options) => {
  if (options.id) {
    getCaseQueryAPI(options.id).then((res) => {
      caseData.value = Object.assign(unref(caseData), res.data)

      caseData.value.applicantPhone = Base64.decode(caseData.value.applicantPhone)
      if (caseData.value.status == 3 || caseData.value.status == 2) {
        active.value = 2
      }
      if (caseData.value.status == 1) {
        active.value = 1
      }
    })
  }
})
function nextStep() {
  active.value = active.value + 1
}
</script>
<style lang="scss" scoped>
::v-deep .wd-cell__right {
  flex: none !important;
}
</style>
